package com.happyghost.javapattern.decorator;

public class PhoneMessageDecorator implements Phone {

    private Phone decoratedPhone;

    public PhoneMessageDecorator(Phone decoratedPhone) {
        this.decoratedPhone = decoratedPhone;
    }

    @Override
    public String callIn() {
        System.out.println("启动录音······");
        String info = decoratedPhone.callIn();
        System.out.println("结束录音,并保存录音文件");
        return info;
    }

    @Override
    public Boolean callOut(String info) {
        System.out.println("启动录音······");
        Boolean result = decoratedPhone.callOut(info);
        System.out.println("结束录音,并保存录音文件");
        return result;
    }

    public String receiveMessage() {
        System.out.println("接收······");
        return "phone message";
    }

    public Boolean sendMessage(String info) {
        System.out.println("发送消息:" + info);
        return true;
    }
}
